<ui:composition
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core">

<div id="header" class="header" >

    <div id="header-logo">

        <div style="position: relative; width: 100%; float: left; top: 15px;" >

            <h:form prependId="false" id="fHeader" >
                <h:commandLink id="lnkHome" action="/global/index.xhtml" immediate="true"  >
                    <h:graphicImage value="/resources/imagenes/intercap.png"  alt="Intercap S.R.L."
                                    width="170" />
                </h:commandLink>
                <p:tooltip for="lnkHome" value="Ir a la pantalla principal"  showEffect="fade" hideEffect="fade" />
            </h:form>
        </div>
    </div>
    
       <ui:insert name="infoCarrito">

            <c:if test="#{usuarioSessionBean.estaRegistrado}" >
                <div id="header-right">
                    <ui:include src="../facturacion/carritoInformacion.xhtml" />
                </div>
            </c:if>
        </ui:insert>

        <c:choose>

            <c:when test="#{usuarioSessionBean.estaRegistrado}">
                <div id="header-menu" >
                    <c:choose>
                        <c:when test="${usuarioSessionBean.usuario.tipo =='A'}">
                            <ui:include src="../seguridad/menu_administrador.xhtml"  />
                        </c:when>
                        <c:otherwise>
                            <ui:include src="../seguridad/menu_usuario.xhtml"  />
                        </c:otherwise>
                    </c:choose>
                </div>
            </c:when>

            <c:when test="#{not usuarioSessionBean.estaRegistrado}">

                <h:form id="fLogin" prependId="false">

                    <!-- Barra de login de usuario-->
                    <!--
                    <p:toolbar style="width: 520px; height: 40px; float: right; margin-top: 5px;;"
                            rendered="#{not usuarioSessionBean.estaRegistrado}" >
                    -->

                     <!--<p:toolbarGroup align="right" style="vertical-align: middle; padding-top: 4px;">-->

                         <p:panel rendered="#{not usuarioSessionBean.estaRegistrado}"
                                  style="width: 380px; height: 50px; float: right; margin-top: 5px; " >

                             



                            <p:growl showDetail="true"  />
                            <h:panelGrid columns="6" style="vertical-align: middle; padding-top: 4px;" >

                                <!--
                                <h:outputText value="#{msgs.usuario}:" />
                                -->
                                <p:inputText id="txtUsuario" value="#{usuarioSessionBean.usuario.nombre}"
                                             required="true"  requiredMessage="#{msgs.campoObligatorio}" size="15"  >
                                    <f:validateLength minimum="4" maximum="20" />
                                </p:inputText>
                                <p:watermark for="txtUsuario" value="Usuario" />

                                <!--
                                <h:outputText id="lblContrasenia" value="#{msgs.password}:" />
                                -->
                                <p:password value="#{usuarioSessionBean.usuario.password}" feedback="false" id="txtPassword"
                                            maxlength="20" required="true"
                                            requiredMessage="#{msgs.campoContraseniaObligatorio}" size="15"  />
                                <p:watermark for="txtPassword" value="Password" />

                                <p:commandButton id="btnLogin" icon="ok16" value="#{msgs.ingresar}" ajax="false"
                                                action="#{usuarioSessionBean.login}"
                                                onclick="ajaxStatus3.show()" />


                                <p:commandButton id="btnAyuda" icon="help16" value="Ayuda"
                                                 onclick="window.open('http://190.225.102.20:8181/documentos/Manual Tienda Virtual.pdf')" />

                            </h:panelGrid>

                     </p:panel>

                     <!--
                     </p:toolbarGroup>
                    </p:toolbar>
                     -->


                </h:form>

            </c:when>

        </c:choose>  
 </div>

</ui:composition>
